{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1593
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var 
	i,j,n,m,cur:longint;
	a:array[0..110,0..110] of longint;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,m);
cur:=1;
i:=1;
while i<=n do begin
	for j:=1 to m do begin
		a[i][j]:=cur;
		inc(cur);
	end;
	inc(i);
	if i<=n then begin
		for j:=m downto 1 do begin
			a[i][j]:=cur;
			inc(cur);
		end;
		inc(i);
	end;
end;
for i:=1 to n do begin
	for j:=1 to m do
		write(a[i][j],' ');
	writeln;
end;
end.